<?php

class CommitController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function commitinAction()
    {
        $this->_helper->viewRenderer->setNoRender();
        $this->_helper->layout->disableLayout();
        $commit = new Application_Model_Commit($_POST);
        $commitM = new Application_Model_CommitMapper();
        $json = Zend_Json::encode(array("id" => $commitM->save($commit)));
        echo $json;
    }
    public function commitoutAction()
    {
        $this->_helper->layout->disableLayout();
        $blogM = new Application_Model_BlogMapper();
        $blog  = new Application_Model_Blog();
        $blogM->find($_POST['blogId'], $blog);
        $this->view->commitId = $blog->getCommitId();
        $commitM = new Application_Model_CommitMapper();
        $this->view->commit = $commitM->findByBlogId($_POST['blogId']);
        if (0 == $_POST['blogId']) $this->view->commitId = 1;
        $this->render("commit");
    }


}

